#ifndef _SOCKETE_H_
#define _SOCKETE_H_

#include "string"
#include "sys/socket.h"
#include "netinet/in.h"
#include "string.h"
#include "unistd.h"
#include "fcntl.h"
#include "arpa/inet.h"

using namespace std;

namespace lvpublisher
{

class Socket
{
public:

    Socket();
    Socket(const string & ip, uint16_t port);
    ~Socket();

    void setAddr(const string & ip, uint16_t port);
    void createSocketfd();
    void bindAddr();
    void listenPort();
    void setNoBlock(int fd, bool value);
    int getfd();
    void closeSocket(int & fd);
    int acceptClient();
    void setPortReuse();


private:
    int m_fd = -1;
    struct sockaddr_in m_addr;


};


#define SOCKETINSTANCE Singleton<Socket>::getInstance()

}


#endif